﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Browser;
using System.ComponentModel;

namespace SLPartApp
{
    public partial class MainPage : UserControl // INotifyPropertyChanged
    {

        public MainPage()
        {
            InitializeComponent();
        }
        
        public MainPage(int item)
        {
            InitializeComponent();
            //selectionList.SelectionChanged -= selectionList_SelectionChanged;
            selectionList.SelectedIndex = item;
            selectionList.SelectionChanged += selectionList_SelectionChanged;
        }


        private void selectionList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                HtmlPage.Window.Invoke("passBack", selectionList.SelectedIndex.ToString(), ((ListBoxItem)selectionList.SelectedItem).Content.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            
        }



    }
}
